]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
st-private: Add support for letter-spacing in ClutterText based StWidgets
authorMario Sanchez Prada <mario@endlessm.com>
Fri, 23 Mar 2018 21:11:52 +0000 (21:11 +0000)
committerMarco Trevisan <mail@3v1n0.net>
Wed, 18 Apr 2018 00:14:05 +0000 (00:14 +0000)
Add support in _st_set_text_from_style(), so that this CSS property can
be used from any StWidget holding an internal ClutterText.

src/st/st-private.c

index 2bdc29b6c2033641c0d27032132a9d2e2a3ac32f..a0100e0945c6f32fa8cdbf951320e8c188ecbf61 100644 (file)
@@ -116,6 +116,7 @@ _st_set_text_from_style (ClutterText *text,
   PangoAttrList *attribs = NULL;
   const PangoFontDescription *font;
   StTextAlign align;
+  gdouble spacing;
 
   st_theme_node_get_foreground_color (theme_node, &color);
   clutter_text_set_color (text, &color);
@@ -123,11 +124,11 @@ _st_set_text_from_style (ClutterText *text,
   font = st_theme_node_get_font (theme_node);
   clutter_text_set_font_description (text, (PangoFontDescription *) font);
 
+  attribs = pango_attr_list_new ();
+
   decoration = st_theme_node_get_text_decoration (theme_node);
   if (decoration)
     {
-      attribs = pango_attr_list_new ();
-
       if (decoration & ST_TEXT_DECORATION_UNDERLINE)
         {
           PangoAttribute *underline = pango_attr_underline_new (PANGO_UNDERLINE_SINGLE);
@@ -143,6 +144,13 @@ _st_set_text_from_style (ClutterText *text,
        */
     }
 
+  spacing = st_theme_node_get_letter_spacing (theme_node);
+  if (spacing)
+    {
+      PangoAttribute *letter_spacing = pango_attr_letter_spacing_new ((int)(.5 + spacing) * PANGO_SCALE);
+      pango_attr_list_insert (attribs, letter_spacing);
+    }
+
   clutter_text_set_attributes (text, attribs);
 
   if (attribs)